#pragma once
#include <boost/signals2.hpp>
#include <SFML/Graphics/View.hpp>
#include <nice2d/component.h>
#include <nice2d/node.h>
#include <nice2d/scene.h>

class SceneCamera : public Component
{
    DECLARE_OBJECT(SceneCamera)
public:
    SceneCamera();
    ~SceneCamera();
public:
    void setScene(ScenePointer scene);
    std::weak_ptr<Scene> getScene();

    void setViewSize(const sf::Vector2f& size);

    sf::View getView()const;
    void setWindowArea(const sf::FloatRect &area);
    void setGlobalArea(const sf::FloatRect &area);
    void setCenter(const sf::Vector2f &center);
    void setTarget(EntityPointer target);
    void setViewport(const sf::FloatRect &area);
    void setRotate(float angle);

    boost::signals2::signal<void(const sf::Vector2f &)> leftTopChanged;
public:
    void update(float deltaTime) override;
private:
    std::unique_ptr<class SceneCameraData> data;
};
